package com.white.bean;

import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * -- 评论ID、用户ID、文章ID、评论内容、评论状态、评论日期、点赞数、回复数。
 *
 * create table comment(
 * commentId int primary key AUTO_INCREMENT comment "评论Id",
 * articleId int comment "评论的文章ID",
 * foreign key(articleId) REFERENCES article(articleId) on delete cascade on update cascade,
 * userId int comment "评论的用户ID",
 * foreign key(userId) REFERENCES user(userId) on delete cascade on update cascade,
 * content longtext comment "内容",
 * status int comment "评论状态",
 * likes int not null default 0 comment "点赞数",
 * replies int not null default 0 comment "回复总数",
 * createTime TIMESTAMP not null default CURRENT_TIMESTAMP comment "发布时间，默认当前时间戳"
 * );
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Comment  implements Serializable {
    @TableId("commentId")
    private Long commentId;
    private Long articleId, userId;
    private int status, likes, replies;
    private String content, createTime;

    public Comment(Long articleId, Long userId, String content) {
        this.articleId = articleId;
        this.userId = userId;
        this.content = content;
    }
}
